package alesa.android.app.movil.ui;

import alesa.android.app.movil.gaproa.ui.GAProaPrincipalActivity;
import alesa.android.app.movil.util.ImageAdapter;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;

public class PrincipalActivity extends Activity
{    
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        GridView listaModulos = (GridView) findViewById(R.id.gv_ListaModulos);
        listaModulos.setAdapter(new ImageAdapter(this));
        
        listaModulos.setOnItemClickListener(new OnItemClickListener()
        {
        	public void onItemClick(AdapterView<?> padre, View vista, int posicion, long id)
        	{
        		Intent LlamadoModulo;
        		switch(posicion)
        		{
        			case 0://Modulo AGProa
        				//Toast.makeText(PrincipalActivity.this, "Aplicacion GAProa Seleccionada", Toast.LENGTH_SHORT).show();
        				LlamadoModulo = new Intent(PrincipalActivity.this, GAProaPrincipalActivity.class);
        				startActivity(LlamadoModulo);
        				
        				break;
        				
        			case 1://Modulo VentasProa
        				Toast.makeText(PrincipalActivity.this, "Aplicacion Ventas Seleccionada", Toast.LENGTH_SHORT).show();
        				break;
        				
        			case 2://Otra Aplicacion
        				Toast.makeText(PrincipalActivity.this, "Aplicacion xxx Seleccionada", Toast.LENGTH_SHORT).show();
        				break;
        		}
			}
		});
    }
}